﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MP/backend.Master" AutoEventWireup="true"
    CodeBehind="User.aspx.cs" Inherits="TimViec.backend.User" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h4 class="alert_info">
        Quản lý người dùng quản trị</h4>
    <div class="module width_full">
        <div class="p_10">
            <table cellpadding="0" cellspacing="10">
                <tr>
                    <td>
                        <strong>ID/Email</strong><span class="text_red">*</span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtEmail" runat="server" Width="300px"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Sai định dạng Email"
                            ControlToValidate="txtEmail" ForeColor="Red" Text="*" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Text="*"
                            ErrorMessage="Email đăng nhập" ControlToValidate="txtEmail" ForeColor="Red"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong>Mật khẩu</strong><span class="text_red">*</span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtMatKhau" runat="server" Width="200px" TextMode="Password"></asp:TextBox>
                        <asp:CheckBox ID="CheckMK" runat="server" Text="Thay đổi mật khẩu" Visible="false"
                            AutoPostBack="True" oncheckedchanged="CheckMK_CheckedChanged" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong>Họ tên</strong><span class="text_red">*</span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtUserName" runat="server" Width="300px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Text="*"
                            ErrorMessage="Họ tên" ControlToValidate="txtUserName" ForeColor="Red"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong>Điện thoại</strong>
                    </td>
                    <td>
                        <asp:TextBox ID="txtDienThoai" runat="server" Width="300px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong>Quyền</strong>
                    </td>
                    <td>
                        <asp:DropDownList ID="droRole" runat="server">
                            <asp:ListItem Value="0">Administrator</asp:ListItem>
                            <asp:ListItem Value="1">Manager</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Button ID="btSave" runat="server" CssClass="buttonNew" Text="Lưu lại" OnClick="btSave_Click" />
                        <asp:Button ID="btUpdate" runat="server" CssClass="buttonNew" Text="Cập nhật" Visible="false"
                            OnClick="btUpdate_Click" />
                        <asp:Button ID="btcancel" runat="server" CssClass="buttonCancel" Text="Hủy bỏ" CausesValidation="false"
                            OnClick="btcancel_Click" />
                    </td>
                </tr>
            </table>
            <br />
            <table cellpadding="0" cellspacing="10">
                <tr>
                    <td>
                        Trạng thái:
                        <asp:DropDownList ID="dropStatus" runat="server">
                            <asp:ListItem Value="0">Mở</asp:ListItem>
                            <asp:ListItem Value="1">Khóa</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                        Từ khóa:
                        <asp:TextBox ID="txtSearch" runat="server" Width="300px"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Button ID="btSearch" runat="server" Text="Tìm kiếm" CssClass="buttonNew" CausesValidation="false"
                            OnClick="btSearch_Click" />
                    </td>
                </tr>
            </table>
            <table cellpadding="0" cellspacing="0" width="100%" class="tablesorter">
                <thead>
                    <tr>
                        <th>
                            STT
                        </th>
                        <th>
                            ID/Email
                        </th>
                        <th>
                            Họ tên
                        </th>
                        <th>
                            Điện thoại
                        </th>
                        <th>
                            Quyền
                        </th>
                        <th>
                            Trạng thái
                        </th>
                        <th>
                            Chức năng
                        </th>
                    </tr>
                </thead>
                <asp:Repeater ID="rptUser" runat="server" onitemcommand="rptUser_ItemCommand">
                    <ItemTemplate>
                        <tr>
                            <td>
                                <%#Container.ItemIndex +1 %>
                            </td>
                            <td>
                                <%#Eval("Email") %>
                            </td>
                            <td>
                                <%#Eval("UserName") %>
                            </td>
                            <td>
                                <%#Eval("DienThoai") %>
                            </td>
                            <td>
                                <%#Eval("Role")%>
                            </td>
                            <td>
                                <%#Eval("Staus") %>
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtEdit" runat="server" CommandName="Edit" Visible='<%#Eval("Khoa") %>'
                                    CommandArgument='<%#Eval("UserId") %>' ToolTip="Cập nhật tài khoản" CausesValidation="false"><img src="../images/backend/icn_edit.png" /></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Khoa" Visible='<%#Eval("Khoa") %>'
                                    CommandArgument='<%#Eval("UserId") %>' CausesValidation="false" OnClientClick="return window.confirm('-Bạn chắc muốn khóa tài khoản này?')"
                                    ToolTip="Khóa tài khoản"><img src="../images/backend/icon_Khoa.png" /></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Mo" Visible='<%#Eval("Mo") %>'
                                    CommandArgument='<%#Eval("UserId") %>' ToolTip="Mở tài khoản" CausesValidation="false"
                                    OnClientClick="return window.confirm('-Bạn chắc muốn mở khóa tài khoản này?')"><img src="../images/backend/icon_open.png" /></asp:LinkButton>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
            <table width="100%">
                <tr>
                    <td>
                        <ul class="paging">
                            <asp:Literal ID="ltlPaging" runat="server" />
                        </ul>
                    </td>
                </tr>
            </table>
        </div>
        <asp:Literal ID="lbUserId" runat="server" Visible="false"></asp:Literal>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="Các trường có dấu (*) bắt buộc phải nhập"
            ShowMessageBox="True" ShowSummary="False" />
    </div>
</asp:Content>
